package com.music.common.errorhandler;

import com.music.common.entity.MemusicExceptionType;
import com.music.common.utils.PreCondition;

public class PresentationException extends MemusicException{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private MemusicExceptionType memusicExceptionType;
	
	public PresentationException() {
        super();
        this.memusicExceptionType = MemusicExceptionType.UNKNOWN;
    }

	public PresentationException(MemusicExceptionType presentationExceptionType) {
        super();
        this.memusicExceptionType = presentationExceptionType;
    }
		
	public PresentationException(String s) {
        super(s);
        this.memusicExceptionType = MemusicExceptionType.UNKNOWN;
    }

	public PresentationException(String s, MemusicExceptionType presentationExceptionType) {
        super(s);
        this.memusicExceptionType = presentationExceptionType;
    }
	
    public PresentationException(String s, Throwable thrown) {
        super(s, thrown);
        this.memusicExceptionType = MemusicExceptionType.UNKNOWN;
    }

    public PresentationException(Throwable thrown) {
        super(thrown);
        this.memusicExceptionType = MemusicExceptionType.UNKNOWN;
    }
    
    public PresentationException(Throwable thrown, MemusicExceptionType presentationExceptionType) {
        super(thrown);
        this.memusicExceptionType = presentationExceptionType;
    }
    
   
    public MemusicExceptionType getPresentationTypeException() {
    	return memusicExceptionType;
    }
    
    public static boolean isPresentationTypeBarredUser(PresentationException pe) {
        PreCondition.assertNotNull(pe, "PresentationException");
        return (MemusicExceptionType.BLOCKED_USER == pe.memusicExceptionType);
    }
    
    public static boolean isPresentationTypeDuplicate(PresentationException pe) {
        PreCondition.assertNotNull(pe, "PresentationException");
        return (MemusicExceptionType.DUPLICATE == pe.memusicExceptionType);
    }

    public static boolean isPresentationTypeNotFound(PresentationException pe) {
        PreCondition.assertNotNull(pe, "PresentationException");
        return (MemusicExceptionType.NOT_FOUND == pe.memusicExceptionType);
    }

}
